package com.comac.print.component.app.domain.gateway.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Description 工单状态枚举
 * @Author yy
 * @Date 2021/4/19 15:35
 */
public enum FoStatusEnum {
    TO_BE_REVIEWED("00","待审查"),
    MATERIAL_TO_BE_ISSUED("01","待发料"),
    TO_BE_REVIEWED_DMIR("02","待DMIR审查"),
    TO_BE_REVIEWED_FAI("03","待FAI审查"),
    PROCESS_COMPLETION("04","工序完成中"),
    MISSING_APPLICATION("05","遗失申请中"),
    TO_BE_TREATED_PROJECT("06","待工程处理"),
    INK_CHANGING("07","墨水更改中"),
    TO_BE_SCRAPPED("08","待报废"),
    WAREHOUSING("09","入库"),
    SCRAPPED("10","已报废"),
    LOSS("11","遗失"),
    LOCKING("12","锁定"),
    CANCELLATION_APPLICATION("13","撤销申请中"),
    RESCINDED("14","已撤销"),
    CANCELLED_RETURN_TO_SUPPLIER("15","退回供应商"),
	INVALID("16","不可用");

    @Getter
    @Setter
    private String code;
    @Getter
    @Setter
    private String description;

    FoStatusEnum(String code, String description){
        this.code = code;
        this.description= description;
    }

    /**
     * 通过code获取枚举值
     * @param code
     * @return
     */
    public static FoStatusEnum getFoStatusEnumByCode(String code){
        return Arrays.stream(FoStatusEnum.values())
                .filter(foStatusEnum -> foStatusEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
